<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Stict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>build Promise</title>

</head>

<body>
<a href="../">../</a>
<script>
    const p = new Promise((resolve, reject) => {
        // resolve('a resolve');//已成功
        reject('a reject')//已失败
        console.log('a console log');//同步任务
    })
    p.then((result) => {//打印 resolve
        console.log(result);
    }).catch((err) => {//打印 reject
        console.log(new Error(err));
    });;
</script>
</body>

</html>